<template>
    <view>
        <!--标题和返回-->
		<cu-custom :bgColor="NavBarColor" isBack :backRouterName="backRouteName">
			<block slot="backText">返回</block>
			<block slot="content">订单表</block>
		</cu-custom>
		 <!--表单区域-->
		<view>
			<form>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">创建人：</text></view>
                  <input  placeholder="请输入创建人" v-model="model.userId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">运单号：</text></view>
                  <input  placeholder="请输入运单号" v-model="model.waybillNo"/>
                </view>
              </view>
              <my-date label="提货时间：" v-model="model.deliveryTime" placeholder="请输入提货时间"></my-date>
              <my-date label="预计送达时间：" v-model="model.estArrivalTime" placeholder="请输入预计送达时间"></my-date>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发货人姓名：</text></view>
                  <input  placeholder="请输入发货人姓名" v-model="model.shipperName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发货人电话：</text></view>
                  <input  placeholder="请输入发货人电话" v-model="model.shipperPhone"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发货人证件号：</text></view>
                  <input  placeholder="请输入发货人证件号" v-model="model.shipperIdNum"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发货人地区编码：</text></view>
                  <input  placeholder="请输入发货人地区编码" v-model="model.shipperAreaCode"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发货人地区名称：</text></view>
                  <input  placeholder="请输入发货人地区名称" v-model="model.shipperAreaName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发货人详细地址：</text></view>
                  <input  placeholder="请输入发货人详细地址" v-model="model.shipperDetailAddr"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">发货方经纬度：</text></view>
                  <input  placeholder="请输入发货方经纬度" v-model="model.shipperLnglat"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">收货方姓名：</text></view>
                  <input  placeholder="请输入收货方姓名" v-model="model.consignerName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">收货方电话：</text></view>
                  <input  placeholder="请输入收货方电话" v-model="model.consignerPhone"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">收件方证件号：</text></view>
                  <input  placeholder="请输入收件方证件号" v-model="model.consignerIdNum"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">收货方地区编码：</text></view>
                  <input  placeholder="请输入收货方地区编码" v-model="model.consignerAreaCode"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">收货方地区名称：</text></view>
                  <input  placeholder="请输入收货方地区名称" v-model="model.consignerAreaName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">收货方详细地址：</text></view>
                  <input  placeholder="请输入收货方详细地址" v-model="model.consignerDetailAddr"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">收货方经纬度：</text></view>
                  <input  placeholder="请输入收货方经纬度" v-model="model.consignerLnglat"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">货物名称：</text></view>
                  <input  placeholder="请输入货物名称" v-model="model.cargoName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">货物件数：</text></view>
                  <input type="number" placeholder="请输入货物件数" v-model="model.cargoPieces"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">货物重量：</text></view>
                  <input type="number" placeholder="请输入货物重量" v-model="model.cargoWeight"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">货物体积：</text></view>
                  <input type="number" placeholder="请输入货物体积" v-model="model.cargoVolume"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">货物价值：</text></view>
                  <input type="number" placeholder="请输入货物价值" v-model="model.cargoPrice"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">货物备注：</text></view>
                  <input  placeholder="请输入货物备注" v-model="model.cargoRemark"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">代收款：</text></view>
                  <input type="number" placeholder="请输入代收款" v-model="model.invoicingFee"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">代收款支付方式：</text></view>
                  <input  placeholder="请输入代收款支付方式" v-model="model.invoicingPayMode"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">是否收取代收款：</text></view>
                  <input type="number" placeholder="请输入是否收取代收款" v-model="model.izInvoicingFee"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">代收款订单号：</text></view>
                  <input  placeholder="请输入代收款订单号" v-model="model.invoicingOrderNum"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">实际代收款支付方式：</text></view>
                  <input  placeholder="请输入实际代收款支付方式" v-model="model.invoicingRealPayMode"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">司机运费：</text></view>
                  <input type="number" placeholder="请输入司机运费" v-model="model.driverFreightFee"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">结算运费状态：</text></view>
                  <input type="number" placeholder="请输入结算运费状态" v-model="model.settleFreightStatus"/>
                </view>
              </view>
              <my-date label="运费结算时间：" v-model="model.settleFreightTime" placeholder="请输入运费结算时间"></my-date>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">运费结算方式：</text></view>
                  <input  placeholder="请输入运费结算方式" v-model="model.settleFreightMode"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">是否指派司机：</text></view>
                  <input type="number" placeholder="请输入是否指派司机" v-model="model.izAssignDriver"/>
                </view>
              </view>
              <my-date label="接单时间：" v-model="model.orderTime" placeholder="请输入接单时间"></my-date>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">接单用户：</text></view>
                  <input  placeholder="请输入接单用户" v-model="model.driverUserId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">司机车牌号：</text></view>
                  <input  placeholder="请输入司机车牌号" v-model="model.driverVehicleNo"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">司机电话：</text></view>
                  <input  placeholder="请输入司机电话" v-model="model.driverPhone"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">司机姓名：</text></view>
                  <input  placeholder="请输入司机姓名" v-model="model.driverName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">司机银行卡：</text></view>
                  <input  placeholder="请输入司机银行卡" v-model="model.driverBankId"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">司机银行开户名：</text></view>
                  <input  placeholder="请输入司机银行开户名" v-model="model.driverBankHolder"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">司机银行卡号：</text></view>
                  <input  placeholder="请输入司机银行卡号" v-model="model.driverBankCardNo"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">司机开户银行：</text></view>
                  <input  placeholder="请输入司机开户银行" v-model="model.driverBankName"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">浏览量：</text></view>
                  <input type="number" placeholder="请输入浏览量" v-model="model.scanNum"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">评论量：</text></view>
                  <input  placeholder="请输入评论量" v-model="model.commentNum"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">订单状态：</text></view>
                  <input  placeholder="请输入订单状态" v-model="model.waybillStatus"/>
                </view>
              </view>
              <view class="cu-form-group">
                <view class="flex align-center">
                  <view class="title"><text space="ensp">状态：</text></view>
                  <input  placeholder="请输入状态" v-model="model.status"/>
                </view>
              </view>
				<view class="padding">
					<button class="cu-btn block bg-blue margin-tb-sm lg" @click="onSubmit">
						<text v-if="loading" class="cuIcon-loading2 cuIconfont-spin"></text>提交
					</button>
				</view>
			</form>
		</view>
    </view>
</template>

<script>
    import myDate from '@/components/my-componets/my-date.vue'

    export default {
        name: "WlhyWaybillForm",
        components:{ myDate },
        props:{
          formData:{
              type:Object,
              default:()=>{},
              required:false
          }
        },
        data(){
            return {
				CustomBar: this.CustomBar,
				NavBarColor: this.NavBarColor,
				loading:false,
                model: {},
                backRouteName:'index',
                url: {
                  queryById: "/waybill/wlhyWaybill/queryById",
                  add: "/waybill/wlhyWaybill/add",
                  edit: "/waybill/wlhyWaybill/edit",
                },
            }
        },
        created(){
             this.initFormData();
        },
        methods:{
           initFormData(){
               if(this.formData){
                    let dataId = this.formData.dataId;
                    this.$http.get(this.url.queryById,{params:{id:dataId}}).then((res)=>{
                        if(res.data.success){
                            console.log("表单数据",res);
                            this.model = res.data.result;
                        }
                    })
                }
            },
            onSubmit() {
                let myForm = {...this.model};
                this.loading = true;
                let url = myForm.id?this.url.edit:this.url.add;
				this.$http.post(url,myForm).then(res=>{
				   console.log("res",res)
				   this.loading = false
				   this.$Router.push({name:this.backRouteName})
				}).catch(()=>{
					this.loading = false
				});
            }
        }
    }
</script>
